package com.biqee.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.biqee.dao.BqUserTbDAO;
import com.biqee.dao.base.BaseDAOImpl;
import com.biqee.model.db.BqUserTb;

public class BqUserTbDAOImpl extends BaseDAOImpl implements BqUserTbDAO {

	@Override
	public BqUserTb readByTbId(Long tbId) {
		return (BqUserTb)getSqlMapClientTemplate().queryForObject(getRealSqlId("readByTbId"), tbId);
	}

	@Override
	public BqUserTb readById(Long id) {
		return (BqUserTb)getSqlMapClientTemplate().queryForObject(getRealSqlId("readById"), id);
	}

	@Override
	public Long create(BqUserTb bqUserTb) {
		return (Long)getSqlMapClientTemplate().insert(getRealSqlId("create"), bqUserTb);
	}

	@Override
	public int updateSessionKey(Long id, String sessionKey) {
		Map<String, Object> condition = new HashMap<String, Object>();
		condition.put("id", id);
		condition.put("sessionKey", sessionKey);
		
		return (Integer)getSqlMapClientTemplate().update(getRealSqlId("updateSessionKey"), condition);
	}

}
